projects
/
gpsbabel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6011091
)
avltree: Fix "avltree_first".
author
oliskoli
<oliskoli>
Sat, 18 Oct 2008 21:43:52 +0000
(21:43 +0000)
committer
oliskoli
<oliskoli>
Sat, 18 Oct 2008 21:43:52 +0000
(21:43 +0000)
avltree.c
patch
|
blob
|
history
diff --git
a/avltree.c
b/avltree.c
index 2726ef713e02e0c1c6393592b6feb9346a4b06d1..d6e7fb25e9aa0ac4cc8f079ef1725e84134cf94d 100644
(file)
--- a/
avltree.c
+++ b/
avltree.c
@@
-195,7
+195,18
@@
avltree_find(const avltree_t *tree, const char *key, const void **data)
const char *
avltree_first(const avltree_t *tree, const void **data)
{
- return avltree_next(tree, NULL, data);
+ avlnode_t *node;
+
+ AVLTREE_CHECK_HANDLE(tree);
+
+ node = tree->root;
+ if (! node) return NULL;
+
+ while (node->left) node = node->left;
+ avltree_save_key((avltree_t *)tree, node->key);
+ if (data) (*data) = node->data;
+
+ return tree->key;
}